package eu.floranet.repositorio.sql;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="sys_objectos")
public class SysObjectos implements Serializable {
	@Id
	private int idobjectos;

	@Column(name="objecto_tabela")
	@Lob
	private String objectoTabela;

	@Column(name="objecto_descritivo")
	@Lob
	private String objectoDescritivo;

	@Column(name="objecto_class")
	@Lob
	private String objectoClass;
	
	@OneToMany(mappedBy="opObjecto")
	private List<RelationObjectoPermissao> listaObjectoPermissao = new ArrayList<RelationObjectoPermissao>();

	private static final long serialVersionUID = 1L;

	public SysObjectos() {
		super();
	}

	public SysObjectos(String objectoTabela, String objectoClass, String objectoDescritivo) {
		this();
		setObjectoTabela(objectoTabela);
		setObjectoDescritivo(objectoDescritivo);
		setObjectoClass(objectoClass);
	}
	
	public int getIdobjectos() {
		return this.idobjectos;
	}

	public void setIdobjectos(int idobjectos) {
		this.idobjectos = idobjectos;
	}

	public String getObjectoTabela() {
		return this.objectoTabela;
	}

	public void setObjectoTabela(String objectoTabela) {
		this.objectoTabela = objectoTabela;
	}

	public String getObjectoDescritivo() {
		return this.objectoDescritivo;
	}

	public void setObjectoDescritivo(String objectoDescritivo) {
		this.objectoDescritivo = objectoDescritivo;
	}

	public String getObjectoClass(){
		return this.objectoClass;
	}
	
	public void setObjectoClass(String objectoClass){
		this.objectoClass = objectoClass;
	}
	
	public List<RelationObjectoPermissao> getListaObjectoPermissao() {
		return this.listaObjectoPermissao;
	}

	public void setListaObjectoPermissao(
			List<RelationObjectoPermissao> listaObjectoPermissao) {
		this.listaObjectoPermissao = listaObjectoPermissao;
	}

	public RelationObjectoPermissao addRelationObjectoPermissao(RelationObjectoPermissao relationObjectoPermissao){
		getListaObjectoPermissao().add(relationObjectoPermissao);
		relationObjectoPermissao.setOpObjecto(this);
		return relationObjectoPermissao;
	}

	public RelationObjectoPermissao removeRelationObjectoPermissao(RelationObjectoPermissao relationObjectoPermissao){
		getListaObjectoPermissao().remove(relationObjectoPermissao);
		relationObjectoPermissao.setOpObjecto(null);
		return relationObjectoPermissao;
	}

}
